<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>{block name="title"}登录{/block} | {__TITLE__}</title>

    <link href="{__ADMIN__}/css/bootstrap.min.css" rel="stylesheet">
    <link href="{__ADMIN__}/font-awesome/css/font-awesome.css" rel="stylesheet">


    <link href="{__ADMIN__}/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="{__ADMIN__}/css/plugins/ladda/ladda-themeless.min.css" rel="stylesheet">
    <link href="{__ADMIN__}/css/plugins/toastr/toastr.min.css" rel="stylesheet">


    <link href="{__ADMIN__}/css/animate.css" rel="stylesheet">
    <link href="{__ADMIN__}/css/style.css" rel="stylesheet">

</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">IN+</h1>

            </div>
            <h3>欢迎登录{$Think.config.admin.name}</h3>
<!--            <p>一套高质量的后台管理html模板</p>-->
            <form class="m-t" role="form" id="form-login">
                <div class="form-group">
                    <input type="text" class="form-control" name="name"  placeholder="用户名" required="">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" name="password"  placeholder="密码" required="">
                </div>
                <button type="button" class="btn btn-primary block full-width m-b" onclick="post_form($(this),'{$Think.config.admin.host}/admin/login')">
                    登录
                </button>

<!--                <a href="#"><small>忘记密码?</small></a>-->
<!--                <p class="text-muted text-center"><small>还没有账号?</small></p>-->
<!--                <a class="btn btn-sm btn-white btn-block" href="register.html">创建一个帐户</a>-->
            </form>
            <p class="m-t"> <small>Copyright {$Think.config.admin.name} {$Think.config.admin.version} &copy;
                {$Think.config.admin.copyright}</small> </p>
        </div>
    </div>

    <!-- Mainly scripts -->
    <script src="{__ADMIN__}/js/jquery-3.1.1.min.js"></script>
    <script src="{__ADMIN__}/js/popper.min.js"></script>
    <script src="{__ADMIN__}/js/bootstrap.js"></script>
    <script src="{__ADMIN__}/js/plugins/ladda/spin.min.js"></script>
    <script src="{__ADMIN__}/js/plugins/ladda/ladda.min.js"></script>
    <script src="{__ADMIN__}/js/plugins/ladda/ladda.jquery.min.js"></script>
    <script src="{__ADMIN__}/js/plugins/sweetalert/sweetalert.min.js"></script>
    <script src="{__ADMIN__}/js/plugins/toastr/toastr.min.js"></script>
    <script src="{__ADMIN__}/dist/src/jquerycookie/jquery.cookie.js"></script>
    <script src="{__ADMIN__}/dist/app.js"></script>

    <script>
        function post_form(that, url) {
            let form_id = that.parents('form').attr('id');
            let target = $('#' + form_id);
            let data = target.serialize();
            let loading = that.ladda();

            // 加载中按钮显示
            loading.ladda('start');
            var response = post_request(url, data);
            if (response.status == 1) {
                var token = response.data.token;
                window.location.href = '{$Think.config.admin.host}/admin/index'
            } else {
                if (!response.msg) {
                    response.msg = '系统出错了';
                }
                show_tip('提示', response.msg, 'error');
            }

            // 加载中按钮隐藏
            loading.ladda('stop');
        }
    </script>

</body>

</html>
